home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgLangD.iso / BORLAND TURBO / MENU95.PAK / GLOBALS.H < prev    next >
Encoding:
C/C++ Source or Header  |  1997-05-06  |  6.2 KB  |  153 lines

  1. // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
  2. // ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
  3. // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
  4. // PARTICULAR PURPOSE.
  5. //
  6. // Copyright (C) 1993-1995  Microsoft Corporation.  All Rights Reserved.
  7. //
  8. // PURPOSE:
  9. //    Contains declarations for all globally scoped names in the program.
  10. //
  11.  
  12. //-------------------------------------------------------------------------
  13. // Functions for handling main window messages.  The message-dispatching
  14. // mechanism expects all message-handling functions to have the following
  15. // prototype:
  16. //
  17. //     LRESULT FunctionName(HWND, UINT, WPARAM, LPARAM);
  18.  
  19. // **TODO**  Add message-handling function prototypes here.  Be sure to
  20. //           add the function names to the main window message table in
  21. //           menu.c.
  22.  
  23. LRESULT MsgCommand(HWND, UINT, WPARAM, LPARAM);
  24. LRESULT MsgDestroy(HWND, UINT, WPARAM, LPARAM);
  25. LRESULT MsgCreate(HWND, UINT, WPARAM, LPARAM);
  26. LRESULT MsgPaint(HWND, UINT, WPARAM, LPARAM);
  27. LRESULT MsgMeasureItem(HWND, UINT, WPARAM, LPARAM);
  28. LRESULT MsgDrawItem(HWND, UINT, WPARAM, LPARAM);
  29. LRESULT MsgButtonUp(HWND, UINT, WPARAM, LPARAM);
  30.  
  31.  
  32. //-------------------------------------------------------------------------
  33. // Functions for handling main window commands--ie. functions for
  34. // processing WM_COMMAND messages based on the wParam value.
  35. // The message-dispatching mechanism expects all command-handling
  36. // functions to have the following prototype:
  37. //
  38. //     LRESULT FunctionName(HWND, WORD, WORD, HWND);
  39.  
  40. // **TODO**  Add message-handling function prototypes here.  Be sure to
  41. //           add the function names to the main window command table in
  42. //           menu.c.
  43.  
  44. LRESULT CmdExit(HWND, WORD, WORD, HWND);
  45. LRESULT CmdAbout(HWND, WORD, WORD, HWND);
  46. LRESULT CmdStates(HWND, WORD, WORD, HWND);
  47. LRESULT CmdColors(HWND, WORD, WORD, HWND);
  48. LRESULT CmdColorOwnerDr(HWND, WORD, WORD, HWND);
  49. LRESULT CmdFont(HWND, WORD, WORD, HWND);
  50. LRESULT CmdSize(HWND, WORD, WORD, HWND);
  51. LRESULT CmdStyle(HWND, WORD, WORD, HWND);
  52.  
  53.  
  54. //-------------------------------------------------------------------------
  55. // Global function prototypes.
  56.  
  57. // **TODO**  Add global function prototypes here.
  58.  
  59. BOOL InitApplication(HINSTANCE, int);
  60. BOOL InitInstance(HINSTANCE, int);
  61. BOOL CenterWindow(HWND, HWND);
  62.  
  63.     // Callback functions.  These are called by Windows.
  64.  
  65. // **TODO**  Add new callback function prototypes here.
  66.  
  67. LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
  68.  
  69. //-------------------------------------------------------------------------
  70. // Global variable declarations.
  71.  
  72. extern HINSTANCE hInst;          // The current instance handle
  73. extern char      szAppName[];    // The name of this application
  74. extern char      szTitle[];      // The title bar text
  75. extern HBITMAP   hbmpDot;        // Dot bitmap for menu selection
  76.  
  77. // **TODO**  For NON-MDI applications, uncomment line 1 below and comment
  78. //           line 2.  For MDI applications, uncomment line 2 below, comment
  79. //           line 1, and then define hwndMDIClient as a global variable in
  80. //           INIT.C
  81. #define hwndMDIClient NULL        /* (1) Stub for NON-MDI applications. */
  82. // extern HWND hwndMDIClient;     /* (2) For MDI applications.          */
  83.  
  84.  
  85. //-------------------------------------------------------------------------
  86. // Message and command dispatch infrastructure.  The following type
  87. // definitions and functions are used by the message and command dispatching
  88. // mechanism and do not need to be changed.
  89.  
  90.     // Function pointer prototype for message handling functions.
  91. typedef LRESULT (*PFNMSG)(HWND,UINT,WPARAM,LPARAM);
  92.  
  93.     // Function pointer prototype for command handling functions.
  94. typedef LRESULT (*PFNCMD)(HWND,WORD,WORD,HWND);
  95.  
  96.     // Enumerated type used to determine which default window procedure
  97.     // should be called by the message- and command-dispatching mechanism
  98.     // if a message or command is not handled explicitly.
  99. typedef enum
  100. {
  101.    edwpNone,            // Do not call any default procedure.
  102.    edwpWindow,          // Call DefWindowProc.
  103.    edwpDialog,          // Call DefDlgProc (This should be used only for
  104.                         // custom dialogs - standard dialog use edwpNone).
  105.    edwpMDIChild,        // Call DefMDIChildProc.
  106.    edwpMDIFrame         // Call DefFrameProc.
  107. } EDWP;                 // Enumeration for Default Window Procedures
  108.  
  109.     // This structure maps messages to message handling functions.
  110. typedef struct _MSD
  111. {
  112.     UINT   uMessage;
  113.     PFNMSG pfnmsg;
  114. } MSD;                  // MeSsage Dispatch structure
  115.  
  116.     // This structure contains all of the information that a window
  117.     // procedure passes to DispMessage in order to define the message
  118.     // dispatching behavior for the window.
  119. typedef struct _MSDI
  120. {
  121.     int  cmsd;          // Number of message dispatch structs in rgmsd
  122.     MSD *rgmsd;         // Table of message dispatch structures
  123.     EDWP edwp;          // Type of default window handler needed.
  124. } MSDI, FAR *LPMSDI;    // MeSsage Dipatch Information
  125.  
  126.     // This structure maps command IDs to command handling functions.
  127. typedef struct _CMD
  128. {
  129.     WORD   wCommand;
  130.     PFNCMD pfncmd;
  131. } CMD;                  // CoMmand Dispatch structure
  132.  
  133.     // This structure contains all of the information that a command
  134.     // message procedure passes to DispCommand in order to define the
  135.     // command dispatching behavior for the window.
  136. typedef struct _CMDI
  137. {
  138.     int  ccmd;          // Number of command dispatch structs in rgcmd
  139.     CMD *rgcmd;         // Table of command dispatch structures
  140.     EDWP edwp;          // Type of default window handler needed.
  141. } CMDI, FAR *LPCMDI;    // CoMmand Dispatch Information
  142.  
  143.     // Message and command dispatching functions.  They look up messages
  144.     // and commands in the dispatch tables and call the appropriate handler
  145.     // function.
  146. LRESULT DispMessage(LPMSDI, HWND, UINT, WPARAM, LPARAM);
  147. LRESULT DispCommand(LPCMDI, HWND, WPARAM, LPARAM);
  148.  
  149.     // Message dispatch information for the main window
  150. extern MSDI msdiMain;
  151.     // Command dispatch information for the main window
  152. extern CMDI cmdiMain;
  153.